package com.pioneer.gui.invoice.controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.pioneer.gui.invoice.model.DropDownList;
import com.pioneer.gui.invoice.model.VectorList;
import com.pioneer.gui.invoice.model.InvoiceModel;

import com.pioneer.gui.invoice.view.InvoicePanel;
import com.pioneer.gui.invoice.view.CustomerPanel;
import com.pioneer.gui.invoice.util.DropDownDataFactory;
import com.pioneer.gui.invoice.util.Constants;
import javax.swing.table.TableModel;

import java.util.Vector;

public class InvoiceSearchButtontoInvoiceSearchListAdapter
implements ActionListener,Constants
{
	    private InvoiceModel _model;	    
    
	    public InvoiceSearchButtontoInvoiceSearchListAdapter(InvoiceModel model)
	    {
	    	this._model=model;
	    }	    
	    
		public void actionPerformed(ActionEvent e)
		{
			VectorList cusList=(VectorList)this._model.getCusId();
			Object obj=cusList.getDatabaseKey();
			if (obj==null)
				return;
			int cusId=((Integer)obj).intValue();			
			VectorList invoiceList=(VectorList)this._model.getInvoiceId();;
			if (cusId==0)
				invoiceList.loadVector(INVOICE_NO);
			else
				invoiceList.loadVector(INVOICE_NO,String.valueOf(cusId));	
		}
}